package edu.nf.ch07.web;

import edu.nf.ch07.service.AuthService;
import edu.nf.ch07.web.vo.ResultVO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangl
 * @date 2025/5/13
 */
@RestController
public class AuthController extends BaseController {

    private AuthService authService;

    public AuthController(AuthService authService) {
        this.authService = authService;
    }

    @PostMapping("/auth")
    public ResultVO<String> auth(@RequestParam("account") String account,
                                 @RequestParam("password") String password) {
        String token = authService.auth(account, password);
        return success(token);
    }
}